angular.module('mamApp').controller('playChannelController', ['$scope', 'PlayControlManager', '$state', '$uibModal',
    function ($scope, PlayControlManager, $state, $uibModal) {
        $scope.search = {
            clientType: $state.params.clientType||'',
            pageNo: $state.params.pageNo || 1,
            pageSize: $state.params.pageSize || 10,
            keyword: $state.params.keyword
        };
        $scope.paginationConf = {
            currentPage: $state.params.pageNo || 1,
            itemsPerPage: $state.params.pageSize || 10,
            pagesLength: 9,
            search: 0,
            onChange: function () {
                $scope.search.pageNo = this.currentPage;
                $scope.search.pageSize = this.itemsPerPage;
                $state.go($state.current.name, $scope.search)
            }
        }

        $scope.new=function (platformId) {
            $scope.platformId=platformId;
            $scope.formData=[];
            var modalInstance = $uibModal.open({
                openedClass:"modal-open-normal",
                animation: true,
                templateUrl: 'newChannel.html',
                controller: 'newChannelModalController',
                resolve: {
                    data: function () {
                        return {platformId:$scope.platformId,formData:$scope.formData};
                    }
                }
            })

            modalInstance.result.then(function (result) {
                $scope.data=result
            })
        };
        //平台列表获取
        var platformid;
        $scope.platformList=[];

        PlayControlManager.playPlatformlList().then(function (result) {
            $scope.platformList=result.data.pageList;
        })
        $scope.paginationConf.totalItems = $scope.platformList.length;

    }])

